package com.example.ai.controller;


import org.springframework.ai.chat.client.ChatClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/ai")
public class ChatController {


    @Autowired
    private ChatClient client;


    @RequestMapping("/chat")
    public String chat(String message) {
        return client.prompt().user(message).call().content();
    }
}
